﻿using System;
using System.Collections.Generic;
using System.Text;
using SchEdu.Framework.Algorithm;
using SchEdu.Framework.Algorithm.Rules;
using SchEdu.Framework.DataModel;
using SchEdu.Framework.Validators;

namespace FAM_DR
{
    class FAM_WSPTAlgorithm : FAM
    {
        protected override void InitializeValidators()
        {
            base.InitializeValidators();
            validators.Add(new OrderWeightValidator(SchEduData));
        }

        protected override SchEduDataSet.OperationRow ApplyDispatchRule(int t,SchEduDataSet.MachineRow machine, OperationList operations)
        {
            SchEduDataSet.OperationRow operation = null;
            foreach (SchEduDataSet.OperationRow op in operations)
            {
                if (operation == null)
                {
                    operation = op;
                }
                if (op.ProcessingTime * op.OrderRow.Weight < operation.ProcessingTime * operation.OrderRow.Weight)
                {
                    operation = op;
                }
            }
            return operation;
        }

        public override AboutInfo AboutInfo
        {
            get
            {
                AboutInfo aboutInfo = new AboutInfo();
                aboutInfo.Title = "FAM WSPT";
                aboutInfo.Description = Resources.FAM_WSPTAlgorithmDescription;
                aboutInfo.Guid = new Guid("{FBFA9502-10B9-49eb-8E08-B16C56376281}");
                return aboutInfo;
            }
        }

    }
}
